<!DOCTYPE html>
<html xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include/src :: form_base_js_and_css"/>
</head>
<body style="background-color: #f2f2f2; height: 100%;">

	<div id="id_panel">
	</div>
	<script th:inline="javascript">

	// 表单初始化
	var formObj = null;
	//使用layui的sku模块
	layui.config({
	    //自定义layui组件的目录,设定扩展的layui模块的所在目录，一般用于外部模块扩展
	    base: '/static/js/layui_extends/',
		version: true
	}).use(['form', 'jquery', 'laydate', 'YsForm', 'YsModal'], function(){
		var $ = layui.jquery,
		form = layui.form,
				laydate = layui.laydate,
				YsForm = layui.YsForm,
				YsModal = layui.YsModal
		/* 
		* 表单初始化
		* 参数1：表单配置参数
		* 参数2：子表配置参数
		*/
		formObj = YsForm.init(
		{
			id:'id_panel', // 页面容器ID
			dto: $.parseJSON(JSON.stringify([[${dto}]]))
		}
		);

		var str = ``
				+ `<div class="layui-inline layui-col-xs4 margin_r_0">`
				+ `<label class="layui-form-label padding_6_0 width_160 margin_0_0_0_N10"><font class="f_red">*</font>收款银行账户名称：</label>`
				+ `<div class="layui-input-block margin_l_150 min_height_38">`
				+ `<input readonly type="text" id="vyhzhmcByDiy" name="_ys_vyhzhmc" value="" class="layui-input height_30 buttontext" lay-verify="required">`
				+ `<i onclick="modalCheckboxByDiy()" style="position: absolute; right: 2px; top:0px; height: 30px; line-height: 30px; width: 25px;" class="layui-icon layui-icon-more" lay-filter="buttontext_modal_checkbox_ByDiy"></i>`
				+ `</div>`
				+ `</div>`;
		formObj.afterFormElement(11,str);

		formObj.matchValuesAfterModalSelectRadio=function (colCode, rowSelected, extraData) { // 单选框选中数据后，匹配表单数值
			var t = formObj;
			var domForm = $('#' + t.c.id_form);
			console.log('rowSelected',rowSelected);
			if(extraData.useIn == 'accountTypeByUser' || extraData.useIn == 'accountTypeByPartner') {//员工账户
				if(extraData.useIn == 'accountTypeByUser') {//员工账户
					formObj.setValueByName("userBankInfoId", rowSelected.id);
					formObj.setValueByName("partnerBankInfoId", '');
					$('#vyhzhmcByDiy').val(rowSelected.vyhzhmc);
					//formObj.setValueByName("vyhzhmc", rowSelected.vyhzhmc);
					formObj.setValueByName("_ys_vkhh", rowSelected.vkhh);
					formObj.setValueByName("_ys_vyhzh", rowSelected.vyhzh);
					formObj.setValueByName("accountTypeByModal", 0);
				}
				if(extraData.useIn == 'accountTypeByPartner') {//合作商账户
					formObj.setValueByName("partnerBankInfoId", rowSelected.id);
					formObj.setValueByName("userBankInfoId", '');
					$('#vyhzhmcByDiy').val(rowSelected.vyhzhmc);
					//formObj.setValueByName("vyhzhmc", rowSelected.vyhzhmc);
					formObj.setValueByName("_ys_vkhh", rowSelected.vkhh);
					formObj.setValueByName("_ys_vyhzh", rowSelected.vyhzh);
					formObj.setValueByName("accountTypeByModal", 1);
				}
			}else{
				for(var i = 0; i < t.c.dto.rows.length; i++){
					var col = t.c.dto.rows[i];
					if (col.code == colCode) {
						// 给选择框设置的字段赋值
						domForm.find('input[name="' + colCode + '"]').val(rowSelected[col.modalValueCode]);
					} else if(col.modalRelativeCode == colCode) {
						domForm.find('input[name="' + col.code + '"]').val(rowSelected[col.modalValueCode]);
					}
				}
			}

		};


		if([[${onProcess}]]=='1'){
			//隐藏头部按钮
			$('#' + formObj.c.id_header).hide();
		}


	});

	</script>
	<script type="text/javascript" src="/static/js/account/tcwAdvanceAccount/form-listen.js"></script>

</body>
</html>
